package com.candy.candycommon.utils;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @author suYanLong
 * @version 1.0
 * @date 2023/6/6 11:49
 * @Description 描述
 */
public class StackTraceUtils {

    public static String getStackTrace(Throwable t) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        try {
            t.printStackTrace(pw);
            return sw.toString();
        } finally {
            pw.close();
        }
    }

}
